<?php defined('IN_LK') or die('Access Denied');?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET?>" />
<title><?php echo LANG('admin_login');?></title>
<script type="text/javascript" src="<?php echo JS_PATH . 'jquery.1.5.1.js';?>"></script>
<link href="<?php echo CSS_PATH . 'admin_login.css';?>?v=0001" type="text/css" rel="stylesheet"/>
</head>
<body onload="javascript:document.myform.username.focus();" scroll="no">
<div class="login">
<div id="login_error" class="message error none"></div>
<div id="loginbox">
    <form action="index.php?m=admin&c=index&a=login" method="post" name="myform">
	<h2><?php echo LANG('welcome');?></h2>
	<dl>
    	<dd>
        <span><?php echo LANG('username');?></span>
        <input class="txt long" type="text" id="u" name="username" value="<?php echo get_cookie('username');?>" />
        </dd>
    	<dd>
        <span><?php echo LANG('password');?></span>
        <input class="txt long" type="password" id="p" name="password" value="" />
        </dd>
    	<dd>
        <span><?php echo LANG('captcha');?></span>
        <input class="txt mid" type="text" id="c" name="captcha" onfocus="show_captcha()" value="" />
        <img title="<?php echo LANG('click_change_validate');?>" id="ca" src="index.php?m=api&a=captcha" onclick="javascript:f(this, this.src)" class="none" />
        </dd>
        <dd><span></span>
	    <input type="hidden" name="HTTP_REFERER" value="<?php echo HTTP_REFERER?>" />
        <input class="btn" type="submit" name="dosubmit" value="<?php echo LANG('login')?>" onclick="return chk()" />
        <input id="jizhu" type="checkbox" name="jizhu" value="1" /><label id="forjizhu" for="jizhu">记住用户名</label> 
        </dd>
    </dl>
    </form>
</div>
</div>
<p id="backtoindex">
<a href="<?php echo SITE_URL?>"><?php echo LANG('go_to_domain');?></a>
<a href="#"><?php echo LANG('lost_password');?></a>
</p>
</body>
</html>
<script language="javascript">
$(function()
{
	var u = $('.txt');
	u.focus(function()
	{
		$(this).addClass('focus');
	});
	u.blur(function()
	{
		$(this).removeClass('focus');
	});
	u.hover(function()
	{
		$(this).addClass('mouseover');
	},function()
	{
		$(this).removeClass('mouseover');
	});
});
function f(obj, url)
{
	obj.src = url + '&v=' + new Date().getDate();
}
function chk()
{
	var al = $('#login_error');
	var name = $('#u');
	var pwd  = $('#p');
	var captcha = $('#c');
	if(name.val() == '')
	{
		al.html('<?php echo LANG('username_not_null');?>').show();
		name.focus();
		return false;
	}
	if(pwd.val() == '')
	{
		al.html('<?php echo LANG('password_not_null');?>').show();
		pwd.focus();
		return false;
	}
	if(captcha.val() == '')
	{
		al.html('<?php echo LANG('captcha_not_null');?>').show();
		captcha.focus();
		return false;
	}
	return true;
}
function show_captcha()
{
	$('#ca').show();
}
function hide_captcha()
{
	$('#ca').hide();
}
</script>